<?php

declare(strict_types=1);

namespace App\CustHub\Controller\Admin\Website;

use App\CustHub\Controller\BaseController;
use App\CustHub\Service\ChCaseService;
use Hyperf\Di\Annotation\Inject;
use Hyperf\HttpServer\Annotation\Controller;
use Hyperf\HttpServer\Annotation\GetMapping;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use Psr\Http\Message\ResponseInterface;

#[Controller(prefix: "custhub/chCase")]
class ChCaseController extends BaseController
{
    #[Inject]
    protected ChCaseService $service;

    /**
     * 获取案例分类列表
     * @return ResponseInterface
     * @throws ContainerExceptionInterface
     * @throws NotFoundExceptionInterface
     */
    #[GetMapping('caseIndustry')]
    public function getCaseIndustry()
    {
        return $this->success($this->service->getCaseIndustry());
    }

    /**
     * 根据获取客户案例列表
     * @return ResponseInterface
     * @throws ContainerExceptionInterface
     * @throws NotFoundExceptionInterface
     */
    #[GetMapping('list-by-industry')]
    public function listByIndustry():ResponseInterface
    {
        return $this->success($this->service->getCaseListByIndustry($this->request->all()));
    }

    /**
     * 获取客户案例详情
     * @return ResponseInterface
     * @throws ContainerExceptionInterface
     * @throws NotFoundExceptionInterface
     */
    #[GetMapping('detail')]
    public function detail():ResponseInterface
    {
        return $this->success($this->service->getCaseDetail($this->request->all()));
    }
}